/*
Navicat MySQL Data Transfer

Source Server         : LocalHost
Source Server Version : 50158
Source Host           : localhost:3306
Source Database       : muza_scenario3

Target Server Type    : MYSQL
Target Server Version : 50158
File Encoding         : 65001

Date: 2011-10-03 12:49:08
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for `tblinfoboard`
-- ----------------------------
DROP TABLE IF EXISTS `tblinfoboard`;
CREATE TABLE `tblinfoboard` (
  `Inf_Par_Id` int(11) NOT NULL DEFAULT '0',
  `Inf_NoT` int(11) DEFAULT NULL,
  `Inf_NoFT` int(11) DEFAULT NULL,
  `Inf_NoR` int(11) DEFAULT NULL,
  `Inf_DoAb` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`Inf_Par_Id`),
  KEY `FK3` (`Inf_Par_Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- ----------------------------
-- Records of tblinfoboard
-- ----------------------------
INSERT INTO `tblinfoboard` VALUES ('1', '1', '1', '1', '2');
INSERT INTO `tblinfoboard` VALUES ('2', '1', '1', '1', '2');
INSERT INTO `tblinfoboard` VALUES ('3', '1', '1', '1', '2');
INSERT INTO `tblinfoboard` VALUES ('4', '0', '0', '0', '0');

-- ----------------------------
-- Table structure for `tblinitiator`
-- ----------------------------
DROP TABLE IF EXISTS `tblinitiator`;
CREATE TABLE `tblinitiator` (
  `Int_Id` int(10) NOT NULL AUTO_INCREMENT,
  `Int_name` varchar(255) DEFAULT NULL,
  `Int_location` varchar(255) DEFAULT NULL,
  `Int_duration` int(11) DEFAULT NULL,
  `Int_cost` int(100) DEFAULT NULL,
  PRIMARY KEY (`Int_Id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;

-- ----------------------------
-- Records of tblinitiator
-- ----------------------------
INSERT INTO `tblinitiator` VALUES ('1', 'init0', 'Älmhult', '36', '10000');
INSERT INTO `tblinitiator` VALUES ('2', 'init1', 'Copenhagen', '36', '10000');
INSERT INTO `tblinitiator` VALUES ('3', 'init2', 'Esbjerg', '36', '10000');

-- ----------------------------
-- Table structure for `tbllog`
-- ----------------------------
DROP TABLE IF EXISTS `tbllog`;
CREATE TABLE `tbllog` (
  `logId` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `logTime` int(11) unsigned NOT NULL DEFAULT '0',
  `logFrom` varchar(255) DEFAULT '',
  `logTo` varchar(255) DEFAULT '',
  `logCategory` varchar(255) DEFAULT '',
  `logType` varchar(255) DEFAULT '',
  `logPhaseNo` varchar(255) DEFAULT NULL,
  `logDetails` varchar(255) DEFAULT '',
  PRIMARY KEY (`logId`)
) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=latin1;

-- ----------------------------
-- Records of tbllog
-- ----------------------------
INSERT INTO `tbllog` VALUES ('1', '0', 'init0', 'Information Board', 'Request', 'Participant List', 'phise_2', 'asking for participant list for init0');
INSERT INTO `tbllog` VALUES ('2', '0', 'Information Board', 'init0', 'Reply', 'Participant List', 'phise_2', 'giving 0 set of participant list to init0');
INSERT INTO `tbllog` VALUES ('3', '1', 'init1', 'Information Board', 'Request', 'Participant List', 'phise_2', 'asking for participant list for init1');
INSERT INTO `tbllog` VALUES ('4', '1', 'Information Board', 'init1', 'Reply', 'Participant List', 'phise_2', 'giving 2 set of participant list to init1');
INSERT INTO `tbllog` VALUES ('5', '1', 'init1', 'part0', 'resource request', 'resource', 'phise_3', 'request for Product A 2');
INSERT INTO `tbllog` VALUES ('6', '1', 'init1', 'Information Board', 'Update', 'NoR', 'phise_3', 'init1updates NoR to IB');
INSERT INTO `tbllog` VALUES ('7', '1', 'init1', 'part1', 'resource request', 'resource', 'phise_3', 'request for Transport Ferry 1');
INSERT INTO `tbllog` VALUES ('8', '1', 'init1', 'Information Board', 'Update', 'NoR', 'phise_3', 'init1updates NoR to IB');
INSERT INTO `tbllog` VALUES ('9', '1', 'init1', 'part2', 'resource request', 'resource', 'phise_3', 'request for Transport Truck 2');
INSERT INTO `tbllog` VALUES ('10', '1', 'init1', 'Information Board', 'Update', 'NoR', 'phise_3', 'init1updates NoR to IB');
INSERT INTO `tbllog` VALUES ('11', '2', 'init2', 'Information Board', 'Request', 'Participant List', 'phise_2', 'asking for participant list for init2');
INSERT INTO `tbllog` VALUES ('12', '2', 'Information Board', 'init2', 'Reply', 'Participant List', 'phise_2', 'giving 0 set of participant list to init2');
INSERT INTO `tbllog` VALUES ('13', '5', 'part0', 'Information Board', 'Update', 'NoR', 'phase_3', 'part0updates NoR to IB');
INSERT INTO `tbllog` VALUES ('14', '5', 'part0', 'init1', 'book request', 'book', 'phase_3', 'booked Product A 2');
INSERT INTO `tbllog` VALUES ('15', '5', 'part1', 'Information Board', 'Update', 'NoR', 'phase_3', 'part1updates NoR to IB');
INSERT INTO `tbllog` VALUES ('16', '5', 'part1', 'init1', 'book request', 'book', 'phase_3', 'booked Transport Ferry 1');
INSERT INTO `tbllog` VALUES ('17', '5', 'part2', 'Information Board', 'Update', 'NoR', 'phase_3', 'part2updates NoR to IB');
INSERT INTO `tbllog` VALUES ('18', '5', 'part2', 'init1', 'book request', 'book', 'phase_3', 'booked Transport Truck 2');
INSERT INTO `tbllog` VALUES ('19', '6', 'init1', 'part0', 'contract agreed', 'contract', 'phise_4', 'agreed contract for Product A 2');
INSERT INTO `tbllog` VALUES ('20', '6', 'init1', 'Information Board', 'Update', 'NoT', 'phise_4', 'init1updates NoT to IB');
INSERT INTO `tbllog` VALUES ('21', '6', 'init1', 'part1', 'contract agreed', 'contract', 'phise_4', 'agreed contract for Transport Ferry 1');
INSERT INTO `tbllog` VALUES ('22', '6', 'init1', 'Information Board', 'Update', 'NoT', 'phise_4', 'init1updates NoT to IB');
INSERT INTO `tbllog` VALUES ('23', '6', 'init1', 'part2', 'contract agreed', 'contract', 'phise_4', 'agreed contract for Transport Truck 2');
INSERT INTO `tbllog` VALUES ('24', '7', 'init1', 'Information Board', 'Update', 'NoT', 'phise_4', 'init1updates NoT to IB');
INSERT INTO `tbllog` VALUES ('25', '10', 'part0', 'Information Board', 'Update', 'NoT', 'phase_4', 'part0updates NoT to IB');
INSERT INTO `tbllog` VALUES ('26', '10', 'part0', 'init1', 'task', 'finish', 'phase_6', 'finish task for Product A 2');
INSERT INTO `tbllog` VALUES ('27', '10', 'part1', 'Information Board', 'Update', 'NoT', 'phase_4', 'part1updates NoT to IB');
INSERT INTO `tbllog` VALUES ('28', '10', 'part1', 'init1', 'task', 'finish', 'phase_6', 'finish task for Transport Ferry 1');
INSERT INTO `tbllog` VALUES ('29', '10', 'part2', 'Information Board', 'Update', 'NoT', 'phase_4', 'part2updates NoT to IB');
INSERT INTO `tbllog` VALUES ('30', '11', 'part2', 'init1', 'task', 'finish', 'phase_6', 'finish task for Transport Truck 2');
INSERT INTO `tbllog` VALUES ('31', '12', 'init1', 'Information Board', 'Update', 'NoFT', 'phise_6', 'init1updates NoFT to IB');
INSERT INTO `tbllog` VALUES ('32', '12', 'init1', 'Information Board', 'Update', 'NoFT', 'phise_6', 'init1updates NoFT to IB');
INSERT INTO `tbllog` VALUES ('33', '12', 'init1', 'Information Board', 'Update', 'NoFT', 'phise_6', 'init1updates NoFT to IB');
INSERT INTO `tbllog` VALUES ('34', '15', 'part0', 'Information Board', 'Update', 'NoFT', 'phase_6', 'part0updates NoFT to IB');
INSERT INTO `tbllog` VALUES ('35', '15', 'part1', 'Information Board', 'Update', 'NoFT', 'phase_6', 'part1updates NoFT to IB');
INSERT INTO `tbllog` VALUES ('36', '16', 'part2', 'Information Board', 'Update', 'NoFT', 'phase_6', 'part2updates NoFT to IB');

-- ----------------------------
-- Table structure for `tblparticipant`
-- ----------------------------
DROP TABLE IF EXISTS `tblparticipant`;
CREATE TABLE `tblparticipant` (
  `Par_Id` int(10) NOT NULL AUTO_INCREMENT,
  `Par_name` varchar(255) DEFAULT NULL,
  `Par_location` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`Par_Id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;

-- ----------------------------
-- Records of tblparticipant
-- ----------------------------
INSERT INTO `tblparticipant` VALUES ('1', 'part0', 'Klaipeda');
INSERT INTO `tblparticipant` VALUES ('2', 'part1', 'Klaipeda');
INSERT INTO `tblparticipant` VALUES ('3', 'part2', 'Klaipeda');
INSERT INTO `tblparticipant` VALUES ('4', 'part3', 'Klaipeda');

-- ----------------------------
-- Table structure for `tblpriority`
-- ----------------------------
DROP TABLE IF EXISTS `tblpriority`;
CREATE TABLE `tblpriority` (
  `Ptb_Int_Id` int(11) DEFAULT '0',
  `Ptb_Priority` double(4,2) DEFAULT NULL,
  `Ptb_Name` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- ----------------------------
-- Records of tblpriority
-- ----------------------------
INSERT INTO `tblpriority` VALUES ('1', '0.50', 'DoAb');
INSERT INTO `tblpriority` VALUES ('1', '0.25', 'TotalCost');
INSERT INTO `tblpriority` VALUES ('1', '0.25', 'TotalDuration');
INSERT INTO `tblpriority` VALUES ('2', '0.50', 'DoAb');
INSERT INTO `tblpriority` VALUES ('2', '0.30', 'TotalCost');
INSERT INTO `tblpriority` VALUES ('2', '0.20', 'TotalDuration');
INSERT INTO `tblpriority` VALUES ('3', '0.45', 'DoAb');
INSERT INTO `tblpriority` VALUES ('3', '0.30', 'TotalCost');
INSERT INTO `tblpriority` VALUES ('3', '0.25', 'TotalDuration');

-- ----------------------------
-- Table structure for `tblresmsg`
-- ----------------------------
DROP TABLE IF EXISTS `tblresmsg`;
CREATE TABLE `tblresmsg` (
  `Rmg_Par_Id` int(11) DEFAULT NULL,
  `Rmg_Int_Id` int(11) DEFAULT NULL,
  `Rmg_res_name` varchar(255) DEFAULT NULL,
  `Rmg_tsk_quanity` int(11) DEFAULT NULL,
  `Rmg_msg_status` int(2) DEFAULT NULL COMMENT '-X= items short; 0=cancelled; 1=sent but not read; 2= booked; 3 = contracted;',
  `Rmg_Id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `Rmg_msg_sending_time` int(11) unsigned zerofill DEFAULT NULL,
  `Rmg_res_type` varchar(255) DEFAULT NULL,
  `Rmg_msg_deadline_time` int(11) unsigned zerofill DEFAULT NULL,
  `Rmg_start_location` varchar(255) DEFAULT NULL,
  `Rmg_end_location` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`Rmg_Id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;

-- ----------------------------
-- Records of tblresmsg
-- ----------------------------
INSERT INTO `tblresmsg` VALUES ('1', '2', 'A', '2', '110', '1', '00000000001', 'Product', '00000000035', 'Klaipeda', 'Klaipeda');
INSERT INTO `tblresmsg` VALUES ('2', '2', 'Ferry', '1', '110', '2', '00000000001', 'Transport', '00000000035', 'Klaipeda', 'Karlshamn');
INSERT INTO `tblresmsg` VALUES ('3', '2', 'Truck', '2', '110', '3', '00000000001', 'Transport', '00000000035', 'Karlshamn', 'Älmhult,Copenhagen,Esbjerg');

-- ----------------------------
-- Table structure for `tblresource`
-- ----------------------------
DROP TABLE IF EXISTS `tblresource`;
CREATE TABLE `tblresource` (
  `Res_Id` int(11) NOT NULL AUTO_INCREMENT,
  `Res_name` varchar(255) DEFAULT NULL,
  `Res_duration` int(11) DEFAULT NULL,
  `Res_cost` double(11,2) unsigned zerofill DEFAULT '00000000.00',
  `Res_quantity` int(11) DEFAULT NULL,
  `Res_type` varchar(255) DEFAULT NULL,
  `Res_Par_Id` int(10) DEFAULT NULL,
  `Res_start_location` varchar(255) DEFAULT '',
  `Res_end_location` varchar(255) DEFAULT '',
  PRIMARY KEY (`Res_Id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;

-- ----------------------------
-- Records of tblresource
-- ----------------------------
INSERT INTO `tblresource` VALUES ('1', 'A', '15', '00000200.00', '13', 'Product', '1', 'Klaipeda', 'Klaipeda');
INSERT INTO `tblresource` VALUES ('2', 'Ferry', '14', '00000500.00', '10', 'Transport', '2', 'Klaipeda', 'Karlshamn');
INSERT INTO `tblresource` VALUES ('3', 'Truck', '4', '00000000.47', '2', 'Transport', '3', 'Karlshamn', 'Älmhult,Copenhagen,Esbjerg');
INSERT INTO `tblresource` VALUES ('4', 'Train', '2', '00000004.73', '2', 'Transport', '4', 'Karlshamn', 'Älmhult');
INSERT INTO `tblresource` VALUES ('5', 'Train', '6', '00000004.73', '2', 'Transport', '4', 'Karlshamn', 'Copenhagen,Esbjerg');

-- ----------------------------
-- Table structure for `tbltask`
-- ----------------------------
DROP TABLE IF EXISTS `tbltask`;
CREATE TABLE `tbltask` (
  `Tas_Id` int(10) NOT NULL AUTO_INCREMENT,
  `Tas_name` varchar(255) DEFAULT NULL,
  `Tas_quan` int(11) DEFAULT NULL,
  `Tas_type` varchar(255) DEFAULT NULL,
  `Tas_Int_Id` int(10) DEFAULT NULL,
  `Tas_start_location` varchar(255) DEFAULT '',
  `Tas_end_location` varchar(255) DEFAULT '',
  PRIMARY KEY (`Tas_Id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;

-- ----------------------------
-- Records of tbltask
-- ----------------------------
INSERT INTO `tbltask` VALUES ('1', 'A', '4', 'Product', '1', 'Klaipeda', 'Klaipeda');
INSERT INTO `tbltask` VALUES ('2', 'Ferry', '1', 'Transport', '1', 'Klaipeda', 'Karlshamn');
INSERT INTO `tbltask` VALUES ('3', '', '4', 'Transport', '1', 'Karlshamn', 'Älmhult');
INSERT INTO `tbltask` VALUES ('4', 'A', '2', 'Product', '2', 'Klaipeda', 'Klaipeda');
INSERT INTO `tbltask` VALUES ('5', 'Ferry', '1', 'Transport', '2', 'Klaipeda', 'Karlshamn');
INSERT INTO `tbltask` VALUES ('6', '', '2', 'Transport', '2', 'Karlshamn', 'Copenhagen');
INSERT INTO `tbltask` VALUES ('7', 'A', '6', 'Product', '3', 'Klaipeda', 'Klaipeda');
INSERT INTO `tbltask` VALUES ('8', 'Ferry', '1', 'Transport', '3', 'Klaipeda', 'Karlshamn');
INSERT INTO `tbltask` VALUES ('9', '', '6', 'Transport', '3', 'Karlshamn', 'Esbjerg');

-- ----------------------------
-- Table structure for `tbltmpreq`
-- ----------------------------
DROP TABLE IF EXISTS `tbltmpreq`;
CREATE TABLE `tbltmpreq` (
  `Trq_Par_Id` int(11) NOT NULL,
  `Trq_NoR` int(11) unsigned zerofill DEFAULT NULL,
  `Trq_NoT` int(11) unsigned zerofill DEFAULT NULL,
  `Trq_NoFT` int(11) unsigned zerofill DEFAULT NULL,
  PRIMARY KEY (`Trq_Par_Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- ----------------------------
-- Records of tbltmpreq
-- ----------------------------
INSERT INTO `tbltmpreq` VALUES ('1', '00000000000', '00000000000', '00000000000');
INSERT INTO `tbltmpreq` VALUES ('2', '00000000000', '00000000000', '00000000000');
INSERT INTO `tbltmpreq` VALUES ('3', '00000000000', '00000000000', '00000000000');
INSERT INTO `tbltmpreq` VALUES ('4', '00000000000', '00000000000', '00000000000');

-- ----------------------------
-- View structure for `getlogmsgforallpairs`
-- ----------------------------
DROP VIEW IF EXISTS `getlogmsgforallpairs`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `getlogmsgforallpairs` AS select `tbllog`.`logFrom` AS `logFrom`,`tbllog`.`logTo` AS `logTo`,count(`tbllog`.`logId`) AS `TotalMsg`,min(`tbllog`.`logTime`) AS `FirstMsg`,max(`tbllog`.`logTime`) AS `LastMsg`,timediff(max(`tbllog`.`logTime`),min(`tbllog`.`logTime`)) AS `TimeTaken` from (`tbllog` join `tblinitiator` on(((`tblinitiator`.`Int_name` = `tbllog`.`logFrom`) or (`tblinitiator`.`Int_name` = `tbllog`.`logTo`)))) group by `tbllog`.`logFrom`,`tbllog`.`logTo` ;

-- ----------------------------
-- View structure for `getlogmsgperinit`
-- ----------------------------
DROP VIEW IF EXISTS `getlogmsgperinit`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `getlogmsgperinit` AS select `tblinitiator`.`Int_name` AS `Int_name`,count(`tbllog`.`logId`) AS `TotalMsg`,min(`tbllog`.`logTime`) AS `FirstMsg`,max(`tbllog`.`logTime`) AS `LastMsg`,timediff(max(`tbllog`.`logTime`),min(`tbllog`.`logTime`)) AS `TimeTaken` from (`tbllog` join `tblinitiator` on(((`tblinitiator`.`Int_name` = `tbllog`.`logFrom`) or (`tblinitiator`.`Int_name` = `tbllog`.`logTo`)))) group by `tblinitiator`.`Int_name` ;

-- ----------------------------
-- View structure for `vwparticipantresource`
-- ----------------------------
DROP VIEW IF EXISTS `vwparticipantresource`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vwparticipantresource` AS select `tblparticipant`.`Par_Id` AS `Par_Id`,`tblparticipant`.`Par_name` AS `Par_name`,`tblresource`.`Res_Id` AS `Res_Id`,`tblresource`.`Res_name` AS `Res_name`,`tblresource`.`Res_duration` AS `Res_duration`,`tblresource`.`Res_cost` AS `Res_cost`,`tblresource`.`Res_quantity` AS `Res_quantity`,`tblresource`.`Res_type` AS `Res_type` from (`tblparticipant` join `tblresource` on((`tblparticipant`.`Par_Id` = `tblresource`.`Res_Par_Id`))) ;

-- ----------------------------
-- View structure for `vwresourcefortask`
-- ----------------------------
DROP VIEW IF EXISTS `vwresourcefortask`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vwresourcefortask` AS select `p1`.`Par_Id` AS `Par_Id_1`,`p1`.`Par_name` AS `Par_name_1`,`p1`.`Par_location` AS `Par_location_1`,`ib1`.`Inf_DoAb` AS `Inf_DoAb_1`,`r1`.`Res_name` AS `Res_name_1`,`r1`.`Res_duration` AS `Res_duration_1`,`r1`.`Res_cost` AS `Res_cost_1`,`r1`.`Res_quantity` AS `Res_quantity_1`,`r1`.`Res_type` AS `Res_type_1`,`r1`.`Res_start_location` AS `Res_start_location_1`,`r1`.`Res_end_location` AS `Res_end_location_1`,`p2`.`Par_Id` AS `Par_Id_2`,`p2`.`Par_name` AS `Par_name_2`,`p2`.`Par_location` AS `Par_location_2`,`ib2`.`Inf_DoAb` AS `Inf_DoAb_2`,`r2`.`Res_name` AS `Res_name_2`,`r2`.`Res_duration` AS `Res_duration_2`,`r2`.`Res_cost` AS `Res_cost_2`,`r2`.`Res_quantity` AS `Res_quantity_2`,`r2`.`Res_type` AS `Res_type_2`,`r2`.`Res_start_location` AS `Res_start_location_2`,`r2`.`Res_end_location` AS `Res_end_location_2`,`p3`.`Par_Id` AS `Par_Id_3`,`p3`.`Par_name` AS `Par_name_3`,`p3`.`Par_location` AS `Par_location_3`,`ib3`.`Inf_DoAb` AS `Inf_DoAb_3`,`r3`.`Res_name` AS `Res_name_3`,`r3`.`Res_duration` AS `Res_duration_3`,`r3`.`Res_cost` AS `Res_cost_3`,`r3`.`Res_quantity` AS `Res_quantity_3`,`r3`.`Res_type` AS `Res_type_3`,`r3`.`Res_start_location` AS `Res_start_location_3`,`r3`.`Res_end_location` AS `Res_end_location_3`,(((`r1`.`Res_cost` * 2) + (`r2`.`Res_cost` * 1)) + (`r3`.`Res_cost` * 1)) AS `TotalCost`,((`r1`.`Res_duration` + `r2`.`Res_duration`) + `r3`.`Res_duration`) AS `TotalDuration`,((`ib1`.`Inf_DoAb` + `ib2`.`Inf_DoAb`) + `ib3`.`Inf_DoAb`) AS `TotalDoAb` from ((((((((`tblparticipant` `p1` join `tblinfoboard` `ib1` on((`ib1`.`Inf_Par_Id` = `p1`.`Par_Id`))) join `tblresource` `r1` on((`r1`.`Res_Par_Id` = `p1`.`Par_Id`))) join `tblresource` `r2` on((`r1`.`Res_Id` <> `r2`.`Res_Id`))) join `tblparticipant` `p2` on((`p2`.`Par_Id` = `r2`.`Res_Par_Id`))) join `tblinfoboard` `ib2` on((`p2`.`Par_Id` = `ib2`.`Inf_Par_Id`))) join `tblresource` `r3` on((`r2`.`Res_Id` <> `r3`.`Res_Id`))) join `tblparticipant` `p3` on((`p3`.`Par_Id` = `r3`.`Res_Par_Id`))) join `tblinfoboard` `ib3` on((`p2`.`Par_Id` = `ib3`.`Inf_Par_Id`))) where ((`r1`.`Res_type` = 'Product') and (`r1`.`Res_quantity` >= 2) and (`r1`.`Res_name` = 'A') and (`r1`.`Res_start_location` = '') and (`r1`.`Res_end_location` = '') and (`r2`.`Res_type` = 'Transport') and (`r2`.`Res_quantity` >= 1) and (`r2`.`Res_start_location` = 'Karlshamn') and (`r2`.`Res_end_location` = 'Ronneby') and (`r3`.`Res_type` = 'Transport') and (`r3`.`Res_quantity` >= 1) and (`r3`.`Res_start_location` = 'Ronneby') and (`r3`.`Res_end_location` = 'Karlskrona') and ((((`r1`.`Res_cost` * 2) + (`r2`.`Res_cost` * 1)) + (`r3`.`Res_cost` * 1)) <= 1000) and (((`r1`.`Res_duration` + `r2`.`Res_duration`) + `r3`.`Res_duration`) <= 36)) order by (((`r1`.`Res_cost` * 2) + (`r2`.`Res_cost` * 1)) + (`r3`.`Res_cost` * 1)),((`ib1`.`Inf_DoAb` + `ib2`.`Inf_DoAb`) + `ib3`.`Inf_DoAb`) desc,((`r1`.`Res_duration` + `r2`.`Res_duration`) + `r3`.`Res_duration`) ;
